/*
 * 作者: 黄伟
 * 时间: 2017-08-16
 * 说明：
 * Copyright (c) 2016-2017 中研沃兮
 */
define(function(require) {

	require("jquery");

	var c = require('app/utils/CommonUtils');
	var APIUtils = require('app/utils/APIUtils');
	var appInfo = require('app/AppInfo');
	var hc = require('app/utils/HttpClientUtils');
	var EventUtils=require('app/utils/EventUtils');
	var param = api.pageParam;
  var action = require('./action/WxpayWinAction');

  var opt =  {};
  $("#cost").keyup(function(){
    $(".dashang-item").removeClass("dashang-item-on");
    $("#othermoney").addClass("dashang-item-on");
  });
  $(".dashang-item").click(function(){
    $(".dashang-item").removeClass("dashang-item-on");
    $(this).addClass("dashang-item-on");
    var cost = $("#cost");
    if((parseInt($(this).text())+"")=="NaN"){
      cost.val("");
      cost.focus();
    }else{
      cost.val($(this).text());
    }
  });
  $("#wxpay_btn").click(function(){
    var cost = $("#cost");
    var money = 0;
    if((parseInt($(".dashang-item-on").text())+"")=="Nan"){
      money=parseFloat(cost.val());
    }else{
      money = parseFloat($(".dashang-item-on").text());
    }
    opt.money = parseInt(parseFloat(money)*100);
    if((""+opt.money)=="NaN"){
      api.alert({
          title: '温馨提示',
          msg: '请输入打赏的数字金额',
      }, function(ret, err){

      });
      $("#cost").val("");
      return;
    }
    action.wxPay1(opt.money);
  });
	return;
});
